<!DOCTYPE html>
<html lang="en">
   <head>
      <meta charset="utf-8">
      <title>w0924_2</title>
   </head>

   <body>
      <img src="images/rhd1.jpg" width="300" height="200" id="i1"/>
      <!-- //<img src="images/rhd2.jpg" width="300" height="200" id="i2"/> -->
      <!-- //<img src="images/rhd3.jpg" width="200" height="300" id="i3"/> -->
      <!-- <img src="images/Btn_submit01.jpg" width="300" height="200" id="i4"/>-->
      <script>
         // 조건문----------------------------------
         // if(조건1){
            // 조건1만족코드
         // }else if(조건2){
            // 조건2만족코드
         // }else{
            // 조건만족x코드
         // }
         
         /* 객체명.메소드명()
               객체명.속성명
               객체명.속성=값
               */
         
         var pic = document.getElementById("i1");
         var picWidth = pic.width;
         // document.write('pic : '+picwidth);
         // pic요소의 속성변경
         
         var t = new Date();
         h = t.getHours();
         if(h<=7){
            document.write('아침 : ');
            pic.src = "images/rhd1.jpg";
         }else if(h>7&&h<=18){
            document.write('오후 : ');
            pic.src = "images/rhd2.jpg";
         }else if(h>18&&h<=24){
            document.write('저녁 : ');
            pic.src = "images/rhd3.jpg";
            pic.width=picWidth*(h/100);
         }else{
            document.write('잘자요 : ');
         }
         
         document.write();
      </script>
   </body>
</html>